---
title: SlackProvider
editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/provider/slack.ts
description: Reference doc for the `SlackProvider`.
---

import { Segment, Section, NestedTitle, InlineSection } from 'toolbeam-docs-theme/components'
import { Tabs, TabItem } from '@astrojs/starlight/components'

<div class="tsdoc">
<Section type="about">
Use this provider to authenticate with Slack.

```ts {5-10}
import { SlackProvider } from "@openauthjs/openauth/provider/slack"

export default issuer({
  providers: {
    slack: SlackProvider({
      team: "T1234567890",
      clientID: "1234567890",
      clientSecret: "0987654321",
      scopes: ["openid", "email", "profile"]
    })
  }
})
```
</Section>
---
## Methods
### SlackProvider
<Segment>
<Section type="signature">
```ts
SlackProvider(config)
```
</Section>
<Section type="parameters">
#### Parameters
- <p><code class="key">config</code> [<code class="type">SlackConfig</code>](/docs/provider/slack#slackconfig)</p>
The config for the provider.
</Section>
<InlineSection>
**Returns** <code class="type">Provider</code>
</InlineSection>
Creates a [Slack OAuth2 provider](https://api.slack.com/authentication/sign-in-with-slack).
```ts
SlackProvider({
  team: "T1234567890",
  clientID: "1234567890",
  clientSecret: "0987654321",
  scopes: ["openid", "email", "profile"]
})
```
</Segment>
## SlackConfig
<Segment>
<Section type="parameters">
- <p>[<code class="key">clientID</code>](#slackconfig.clientid) <code class="primitive">string</code></p>
- <p>[<code class="key">clientSecret</code>](#slackconfig.clientsecret) <code class="primitive">string</code></p>
- <p>[<code class="key">pkce?</code>](#slackconfig.pkce) <code class="primitive">boolean</code></p>
- <p>[<code class="key">query?</code>](#slackconfig.query) <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code></p>
- <p>[<code class="key">scopes</code>](#slackconfig.scopes) <code class="symbol">(</code><code class="symbol">&ldquo;</code><code class="primitive">email</code><code class="symbol">&rdquo;</code><code class="symbol"> | </code><code class="symbol">&ldquo;</code><code class="primitive">profile</code><code class="symbol">&rdquo;</code><code class="symbol"> | </code><code class="symbol">&ldquo;</code><code class="primitive">openid</code><code class="symbol">&rdquo;</code><code class="symbol">)[]</code></p>
- <p>[<code class="key">team</code>](#slackconfig.team) <code class="primitive">string</code></p>
</Section>
</Segment>
<NestedTitle id="slackconfig.clientid" Tag="h4" parent="SlackConfig.">clientID</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code>
</InlineSection>
</Section>
The client ID.

This is just a string to identify your app.
```ts
{
  clientID: "my-client"
}
```
</Segment>
<NestedTitle id="slackconfig.clientsecret" Tag="h4" parent="SlackConfig.">clientSecret</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code>
</InlineSection>
</Section>
The client secret.

This is a private key that's used to authenticate your app. It should be kept secret.
```ts
{
  clientSecret: "0987654321"
}
```
</Segment>
<NestedTitle id="slackconfig.pkce" Tag="h4" parent="SlackConfig.">pkce?</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">boolean</code>
</InlineSection>
</Section>

<InlineSection>
**Default** false
</InlineSection>
Whether to use PKCE (Proof Key for Code Exchange) for the authorization code flow.
Some providers like x.com require this.
</Segment>
<NestedTitle id="slackconfig.query" Tag="h4" parent="SlackConfig.">query?</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code>
</InlineSection>
</Section>
Any additional parameters that you want to pass to the authorization endpoint.
```ts
{
  query: {
    access_type: "offline",
    prompt: "consent"
  }
}
```
</Segment>
<NestedTitle id="slackconfig.scopes" Tag="h4" parent="SlackConfig.">scopes</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="symbol">(</code><code class="symbol">&ldquo;</code><code class="primitive">email</code><code class="symbol">&rdquo;</code><code class="symbol"> | </code><code class="symbol">&ldquo;</code><code class="primitive">profile</code><code class="symbol">&rdquo;</code><code class="symbol"> | </code><code class="symbol">&ldquo;</code><code class="primitive">openid</code><code class="symbol">&rdquo;</code><code class="symbol">)[]</code>
</InlineSection>
</Section>
The scopes to request from the user.

| Scope | Description |
|-|-|
| `email` | Grants permission to access the user's email address. |
| `profile` | Grants permission to access the user's profile information. |
| `openid` | Grants permission to use OpenID Connect to verify the user's identity. |
</Segment>
<NestedTitle id="slackconfig.team" Tag="h4" parent="SlackConfig.">team</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code>
</InlineSection>
</Section>
The workspace the user is intending to authenticate.

If that workspace has been previously authenticated, the user will be signed in directly,
bypassing the consent screen.
</Segment>
</div>